<template>
  <el-container style="min-height: 100vh; height: 100%;">
    <el-header>
      <div>
        <Header></Header>
      </div>
    </el-header>
    <el-main>
      <div style="margin-top: 55px;">
        <div style="text-align: center;">
          <h3>{{ content.title }}</h3>
           <span>{{ content.author }} | {{ content.create_time | formatDateTime }}</span>
        </div>
        <p />
        <el-row>
          <el-col>
            <div style="width: 54%; margin-left: 23%; text-align: justify;" v-html="content.content"></div>
          </el-col>
        </el-row>
      </div>
    </el-main>
    <el-footer>
      <div>
        <Footer></Footer>
      </div>
    </el-footer>
  </el-container>
</template>
  

<script>

export default {
  name: 'Content',
  head(){
    return {
      title: this.content.title,
      meta: [
        {
          hid: 'description',
          name:'description',
          content: this.content.title
        }
      ]
    }
  },
  data() {
    return {
      id: '',
      content: {}
    };
  },
  created: function () {
    this.id = this.$route.params.id
    this.load()
  },
  methods: {
    load: function () {
      let api = "/api/blog/load/" + this.id
      let that = this
      this.$axios.get(api).then((response) => {
        let code = response.data.code
        if (code == 0) {
          that.content = response.data.data
         
        }

      })
    }

  }
}
</script>
  
  <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped></style>
  
  